#!/bin/sh
function help(){
	echo "xc node filepath"
}

help
ops=/Users/Shared/ops/ops.jar
node=node
file=file

if [[ -n $1 ]];then
  node=$1
fi

if [[ -n $2 ]];then
  file=$2
fi


echo "node=$node"
echo "file=$file"

host=`x list $node |awk '{print $2}'|awk -F ',' '{print $1}'|awk -F ')' '{print $1}' |sed $'s/\'//g'`
port=`x list $node |awk '{print $4}'|awk -F ',' '{print $1}'|awk -F ')' '{print $1}' |sed $'s/\'//g'`
pwd=`x list $node|awk '{print $8}'|awk -F ',' '{print $1}'|awk -F ')' '{print $1}' |sed $'s/\'//g'`

echo "host=$host"
echo "port=$port"
echo "pwd=$pwd"
echo "ops=$ops"
echo "$host|$port|root|$pwd|hostname=ops">/tmp/base.node
java -jar $ops -n /tmp/base.node -sftp upload -s $2 -df upload.file -dd /tmp


exit 0